<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@taglib prefix="decorator" uri="http://www.opensymphony.com/sitemesh/decorator" %>
<%@taglib prefix="page" uri="http://www.opensymphony.com/sitemesh/page" %>
<%@taglib prefix="s" uri="/struts-tags" %>
<%--<% response.sendRedirect("index.action"); %>--%>

<head>
    <title>首页</title>
    <style>
        .header_back {
            margin-top: -20px;
            padding-top: 20px;
            background: url(${pageContext.request.contextPath}/styles/images/background.jpg) no-repeat top right;
        }
    </style>
</head>

<div class="col-sm-9">
    <div class="row header_back">
        <div class="col-lg-12">
            <div class="page-header">
                <h1>欢迎您！</h1>
            </div>
        </div>
    </div>

    <!--Statistics-->
    <div class="row">
        <div class="col-lg-12">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <div class="text-muted bootstrap-admin-box-title">统计</div>
                </div>
                <div class="bootstrap-admin-panel-content">
                    <div class="row">
                        <div class="col-xs-3">
                            <p class="title text-center"><s:property value="#todayPostCount"/></p>

                            <p class="detail text-center">今日发表</p>
                        </div>
                        <div class="col-xs-3">
                            <p class="title text-center"><s:property value="#totalPostCount"/></p>

                            <p class="detail text-center">总算法数</p>
                        </div>
                        <div class="col-xs-3">
                            <p class="title text-center"><s:property value="#todayDownloadCount"/></p>

                            <p class="detail text-center">今日下载量</p>
                        </div>
                        <div class="col-xs-3">
                            <p class="title text-center"><s:property value="#totalDownloadCount"/></p>

                            <p class="detail text-center">总下载量</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!--Lastest-->
    <div class="row">
        <div class="col-md-6">
            <div class="panel panel-success">
                <div class="panel-heading">
                    <div class="text-muted bootstrap-admin-box-title">最近发表</div>
                </div>
                <div class="bootstrap-admin-panel-content">
                    <table class="table table-striped">
                        <thead>
                        <tr>
                            <th>算法名称</th>
                            <th>发表时间</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <s:iterator value="#lastedAddedArticles">
                            <tr>
                                <td>
                                    <s:a action="article_details?id=%{id}">${title}</s:a>
                                </td>
                                <td>
                                    <s:date name="createTime" format="yyyy/MM/dd"/>
                                </td>
                                <td>
                                    <s:a action="article_getAttachment?id=%{id}">下载</s:a>
                                </td>
                            </tr>
                        </s:iterator>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="panel panel-info">
                <div class="panel-heading">
                    <div class="text-muted bootstrap-admin-box-title">最多下载</div>
                </div>
                <div class="bootstrap-admin-panel-content">
                    <table class="table table-striped">
                        <thead>
                        <tr>
                            <th>算法名称</th>
                            <th>发表时间</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <s:iterator value="#mostDownloadArticles">
                            <tr>
                                <td>
                                    <s:a action="article_details?id=%{id}">${title}</s:a>
                                </td>
                                <td>
                                    <s:date name="createTime" format="yyyy/MM/dd"/>
                                </td>
                                <td>
                                    <s:a action="article_getAttachment?id=%{id}">下载</s:a>
                                </td>
                            </tr>
                        </s:iterator>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>